package com.fr.base.core.antlr;

import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;

public class NameSpace
{
  private Vector names = new Vector();
  private String _name;

  public NameSpace(String paramString)
  {
    this._name = new String(paramString);
    parse(paramString);
  }

  public String getName()
  {
    return this._name;
  }

  protected void parse(String paramString)
  {
    StringTokenizer localStringTokenizer = new StringTokenizer(paramString, "::");
    while (localStringTokenizer.hasMoreTokens())
      this.names.addElement(localStringTokenizer.nextToken());
  }

  void emitDeclarations(PrintWriter paramPrintWriter)
  {
    Enumeration localEnumeration = this.names.elements();
    while (localEnumeration.hasMoreElements())
    {
      String str = (String)localEnumeration.nextElement();
      paramPrintWriter.println("ANTLR_BEGIN_NAMESPACE(" + str + ")");
    }
  }

  void emitClosures(PrintWriter paramPrintWriter)
  {
    for (int i = 0; i < this.names.size(); ++i)
      paramPrintWriter.println("ANTLR_END_NAMESPACE");
  }
}